 # -*- coding: utf-8 -*-
 
from django.http import HttpResponse
from django.shortcuts import render, redirect
 
from TestModel.models import Test


def admindata(request):
    items = Test.objects.all()

    if request.method == 'POST':
        item_id = request.POST.get('id')
        item = Test.objects.get(pk=item_id)
        item.delete()
        return redirect('admindata')

    context = {'items': items}
    return render(request, 'admindata.html', context)